public class project {
    public int numRabbits(int[] answers) {
        int[] arr=new int[1000];
        int sum=0;
        for(int i : answers){
            if(arr[i]>0){
                arr[i]--;
            }else{
                arr[i]=i;
                sum+=1+i;
            }
        }
        return sum;
    }
}
